package main

import (
	"fmt"
)

type ts struct {
	a int `json:"a,readonly"`
	b *string
}

func main() {
	var (
		x interface{} = nil
		f interface{} = float32(1.23)
	)

	if fv, ok := x.(float32); ok {
		fmt.Printf("[1]get fv = %f\n", fv)
	} else {
		fmt.Printf("[1]x is nil\n")
	}

	if fv, ok := x.(float32); ok && x != nil {
		fmt.Printf("get fv = %f\n", fv)
	} else {
		fmt.Printf("x is nil\n")
	}
	if fv, ok := f.(float32); ok && f != nil {
		fmt.Printf("get fv = %f\n", fv)
	}
	var b = &ts{
		a: 1,
		b: nil,
	}
	fmt.Printf("b.b = %s\n", *b.b)
}
